1. Technical Field
The present invention relates generally to the field of computer software and, more particularly, to methods and systems for selecting classes and data files to store multiple versions of application software in order to avoid unnecessary duplication of classes and files between multiple versions of the same application software.
2. Description of Related Art
The JAVA computer programming language is an object-oriented language. JAVA is a trademark of Sun Microsystems, Inc. C++ is another of an object-oriented language. In these types of programming languages, an object is a set of data and methods that operate on that data. To use objects in an application or program, a programmer need only know what the objects do an not how they do it. The data and the details of implementation of the methods are hidden from the users. They are xe2x80x9cencapsulatedxe2x80x9d in the object.
A class is a template for creating objects. From a class, one can create (instantiate) any number of objects, each of which will have its own data and an identical set of methods that apply to the data. The instantiation of an object from a class is accomplished by using the constructor method of the class to set the initial values of the data. A class may have several constructors, with different numbers and data types for the parameters passed to the constructor. The identifier of any constructor method is the same as the identifier of the class.
New classes can be created by extending existing classes. Such a new class then inherits all the methods and data field from the base (or parent) class. Data fields and methods can be added and existing methods changed (overridden).
Object-oriented programming makes it convenient to reuse existing classes either to create objects or to produce new classes. JAVA has a library of classes which can be used to produce programs from off-the-shelf (already created and stored in a class library) components.
Software applications written in object programming languages, such as JAVA, may include multiple classes. The classes contained within an application often change when a new release or updated version of the application is created. Many times, however, only a small number of the classes change. The changes in the classes between releases of an application may be made for different reasons. For example, the change may be to add new features to the software application or to fix problems associated with previous releases of the software application. One potential pitfall of making changes is that a new class may no longer be compatible with older classes.
When multiple software versions of an application are installed on one system, the correct set of classes must be used for the specified version. One solution is to install each version in its own directory. However, if only a small number of classes or files have changed, this solution is very inefficient. Also, this situation means that the two separate installations may not share the same application data, user preferences, etc. Therefore, a method and system that provides a more efficient means of storing and utilizing different versions of an application on a single system is desirable.
The present invention provides a method, system and apparatus for loading the correct version of a file in a system in which multiple versions of the same file and multiple versions of a requesting application reside. In a preferred embodiment, a class loader receives a request, from a requesting application, to load a file. The request includes an indication of the current version of the requesting application. The class loader retrieves from a plurality of files, the one version of the requested file that is compatible with the requesting application and then loads that version of the file. Each of the plurality of files includes an indication of a plurality of versions for which the particular file is compatible. The plurality of versions for which the version of the requested file that is selected is compatible includes the version of the requesting application.